<?php
// 本类由系统自动生成，仅供测试用途
class HomeAction extends Action {
      function _initialize(){ 
         if($_GET['gid']){
             
            $group=M('Groups');//group_sort'
            $data['gid']=$_GET['gid'];
            $group=$group->where($data)->field('gid,group_name,group_num,group_logo,group_intro,user_id,user_name')->find();
            //dump($group);
            $this->assign('Group',$group);
            //查询关键字
            $keydata['main_id']=$data['gid'];
            $keydata['type']='groups';
            $keyword=D('KeywordView');
            $keylist=$keyword->where($keydata)->field('id,key_name,key_count')->select();
            
         }
       //  dump($group);
         $this->assign('mainkey_list',$keylist);
          //dump($keylist);
         $this->assign('gid',$_GET['gid']);
         $this->visit();
     }
     function visit(){
//        import('@.ORG.IpLocation');
         $visit=M('Visit');
         $ip = get_client_ip(); // 测试IP
         $data['ip']=$ip;
         if($list=$visit->where($data)->find()){ 
             $data['id']=$list['id'];
             $data['visit_time']=date('Y-m-d H:i:s',  time());
             $visit->save($data);
         }else{
             $data['visit_time']=date('Y-m-d H:i:s',  time());
              $visit->add($data);
         }
     }
}